<?php
class DefinegenreControl extends CI_controller {

	function __construct() {
        parent::__construct();
        $this->load->helper('url');
        $this->load->model('moviesmodel');
        $this->load->model('genresmodel');
        $this->load->model('ahlifilmModel');
    }
    
    function index(){
    	$this->load->view('definegenrePage');
    }
    
	function show_movie() {
//		$movie = $this->moviesmodel->getAllMovie()->result();

		$film['detail'] = $this->moviesmodel->getAllMovie()->result();
		$this->load->view('definegenrePage',$film);
//		echo $movie->TITLE;
//		$this->load->view('definegenrePage');
//		$i=0;
//		$define[$i]['detail'] = $this->ahlifilmModel->get_movie()->result();
//		$this->load->view('definegenrePage',$define);
//        $this->load->model('ahlifilmModel');
//        $data['detail']= $this->ahlifilmModel->get_movie();
//        $data['movie']= $this->ahlifilmModel->get_movie();
//
//        $this->load->view('definegenrePage',$data);
//        $data = $this->ahlifilmModel->get_movie();
//        $i = 0;
//        foreach($data->result() as $row)
//        {
//            $titleFilm[$i] = $row->title;
//            echo $titleFilm[$i];
//            $i++;
//        }
        //$this->load->view('ahlifilmPage',$titleFilm);*/
    }

    function show_genre() {
//        $this->load->model('ahlifilmModel');
//        $data['detail2']= $this->ahlifilmModel->get_genre($movieId);
//        $this->load->view('ahlifilmPage',$data);
        
         $x2 = $this->ahlifilmModel->get_movie();
        $j = 0;
       foreach($x2->result() as $row2)
        {
            $data[$j] = $this->ahlifilmModel->get_genre($row2->MOVIEID);
           /* foreach($data->result() as $row)
            {
                $genre[$j] = $row->genre;
                echo $genre[$j];
//                $j++;
            }*/
            $j++;
       }
      //  $datax = $this->ahlifilmModel->get_genre(1);
       $x['detail'] = $data;
       $this->load->view('definegenrePage',$x);

//        $data2 = $this->ahlifilmModel->get_movie();
//        $this->load->model('ahlifilmModel');
//        foreach($data2->result() as $row2){
//            $data['query']= $this->ahlifilmModel->get_genre($row2->MOVIEID);
//        }
//        print_r($data);
//        $this->load->view('ahlifilmPage',$data);
        
    }
    
    
    
    
}